export default defineEventHandler((event) => {
    const redirectUri = 'http://localhost:3000/api/auth/google/callback'
    const clientId = process.env.GOOGLE_CLIENT_ID
    const scope = 'openid profile email'
    const state = crypto.randomUUID()

    const url = `https://accounts.google.com/o/oauth2/v2/auth?response_type=code&client_id=${clientId}&redirect_uri=${encodeURIComponent(
    redirectUri
    )}&scope=${encodeURIComponent(scope)}&state=${state}`

    return sendRedirect(event, url)
  })
  